<?php

require_once("root.php");
require_once($ROOT . "base.inc.php");

class ContactTest extends BaseTest {

   function test ()
   {

      $contact = new Contact(0, "Mark", "Simoneau", "", "", "512-989-8329", "512-971-3864", "mark@greenletters.com", 0);
      $address = new Address(0, "1020 Apple Cross", "", "Pflugerville", "TX", "78660");

	echo "Saving\n\n";
	  ContactLogic::save($contact, $address);

	echo "Got back $contact->id\n\n";

	  $fullContact = ContactLogic::load($contact->id);
	  print_r($fullContact);

	echo "Updating (" . $fullContact->contact->id . ")\n\n";
	  $fullContact->contact->firstname = "Andrea";
	  ContactLogic::save($fullContact->contact, $fullContact->address);

	  $fullContact = ContactLogic::load($fullContact->contact->id);
	  print_r($fullContact);

	  ContactLogic::tagAsType($fullContact->contact->id, 1);

	  $tags = ContactLogic::getTagsForContact($fullContact->contact->id);
	  print_r($tags);

	echo "Deleting (" . $fullContact->contact->id . ")\n\n";
	  ContactLogic::delete($fullContact->contact->id);

	echo "All:\n\n";
	  $results = ContactLogic::findAll();
	  print_r($results);

   }

}

echo "<pre>";
$test = new ContactTest();
$test->test();
echo "</pre>";


?>
